<template>
    <div>
      <svg-icon :icon-class="iconClass" @click="goto" />
    </div>
  </template>
  
  <script>
  export default {

    name: 'LingMsg',

    props: {
        hasNewMessages: {
            type: Boolean,
            default: true
            
        }
    },
    
    computed: {
        iconClass() {
            return this.hasNewMessages ? 'msg-new' : 'email';
        }
    },
    data() {
          // 动态获取当前应用运行的端口号
          const port = window.location.port;
        // 拼接完整的 URL
        const protocol = window.location.protocol; // 获取当前协议，如 http:
        const baseUrl = `${protocol}//localhost:${port}/msg/msg`;
      return {
        url: baseUrl,
      }
    },
    methods: {
      goto() {
        window.open(this.url)
      }
    }
  }
  </script>